﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;

namespace SMS.Common.Search
{
    /// <summary>
    /// 搜索条件
    /// </summary>
    [Serializable]
    [DataContract()]
    public abstract class SearchCondition
    {
        /// <summary>
        ///  获取或设置当前分页每页大小
        /// </summary>
        [DataMember()]
        public int PageSize { get; set; }
        /// <summary>
        ///  获取或设置当前分页索引
        /// </summary>
        [DataMember()]
        public int CurrentPageIndex { get; set; }
        /// <summary>
        /// 获取或设置要加载的字段
        /// </summary>
        [DataMember()]
        public string[] LoadProperties { get; set; }
        /// <summary>
        /// 获取或设置是否加载全部记录
        /// </summary>
        [DataMember()]
        public bool LoadAllRecords
        {
            get;
            set;
        }
        /// <summary>
        /// 排序方式，正序可为空或ASC,逆序为DESC(如：字段名1 DESC,字段名2）。
        /// </summary>
        [DataMember()]
        public string OrderBy { get; set; }

        public static IEnumerable<Type> GetKnownTypes(ICustomAttributeProvider provider)
        {
            return new Type[] { 
                typeof(StringFilterCondition),
                typeof(DarkSearchCondition)
            };
        }
    }
}
